package com.itlong.cloud.iottp;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      极光推送模块接口。
 * <desc/>
 *
 * @createDate 2017/10/12.
 */
@FeignClient(name = "iot-tp-service")
public interface IIotTpJPushClientServiceClient {

     /**
      * <desc>
      *      推送所有平台，所有用户，内容为 msg 的通知。
      * <desc/>
      *
      * @param  msg  推送消息
      * @param  extra 附加字段
      * @return
      * @author shengen.T
      * @createDate 2017/10/12
      */
    @RequestMapping(path = "/iotTp/push/pushAll",method = RequestMethod.POST)
    boolean pushAll(@RequestParam("msg") String msg,@RequestBody Map<String,String> extra) throws Exception;

     /**
      * <desc>
      *      标签推送指令。
      * <desc/>
      *
      * @param   msg  推送消息
      * @param   projectId  项目编号
      * @param   userPhone  用户手机
      * @param   devSip  设备SIP
      * @param   roomSip 房间SIP
      * @return
      * @author shengen.T
      * @createDate 2017/10/12
      */
    @RequestMapping(path = "/iotTp/push/pushWithTag",method = RequestMethod.POST)
    boolean pushWithTag(@RequestParam("msg") String msg,
                        @RequestParam("projectId") String projectId,
                        @RequestParam("userPhone") String userPhone,
                        @RequestParam("devSip")String devSip,
                        @RequestParam("roomSip") String roomSip) throws Exception;

    /**
     * <desc>
     *      标签推送指令。
     * <desc/>
     *
     * @param   msg  推送消息
     * @param   userPhone  用户手机
     * @param   devSip  设备SIP
     * @param   roomSip 房间SIP
     * @return
     * @author shengen.T
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/iotTp/push/pushWithByPhoneTag",method = RequestMethod.POST)
    boolean pushWithByPhoneTag(@RequestParam("msg") String msg,
                               @RequestParam("userPhone") String userPhone,
                               @RequestParam("devSip")String devSip,
                               @RequestParam("roomSip") String roomSip) throws Exception;

    /**
     * <desc>
     *      标签推送指令(针对所有平台，指定项目推送)。
     * <desc/>
     *
     * @param   msg  推送消息
     * @param   projectId  项目编号
     * @return
     * @author shengen.T
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/iotTp/push/pushWithProjectTag",method = RequestMethod.POST)
    boolean pushWithProjectTag(@RequestParam("msg") String msg,
                        @RequestParam("projectId") String projectId) throws Exception;

    /**
     * <desc>
     *      任务指令推送。
     *      使用场景：APP账单详情
     * <desc/>
     *
     * @param userPhone  用户手机
     * @param serviceType  服务类型
     * @param msg
     * @return true 成功 false 失败
     * @author Jiaqi.X
     * @createDate 2018/08/20
     */
    @RequestMapping(path = "/iotTp/push/pushWithTaskForBillTO",method = RequestMethod.POST)
    public boolean pushWithTaskForBillTO(@RequestParam("userPhone") String userPhone,
                                         @RequestParam("serviceType")String serviceType,
                                         @RequestParam("msg")String msg,
                                         @RequestParam("projectId") String projectId) throws IOException;

     /**
      * <desc>
      *      任务指令推送。
      * <desc/>
      *
      * @param  projectId 项目编号
      * @param   userPhone  用户手机
      * @param  comands 指令 刷新设备 1成功刷新 2失败不需要刷新
      * @param  msg 推送信息
      * @return
      * @author shengen.T
      * @createDate 2017/10/12
      */

    @RequestMapping(path = "/iotTp/push/pushWithTaskTO",method = RequestMethod.POST)
    boolean pushWithTaskTO(@RequestParam("projectId") String projectId,
                         @RequestParam("userPhone") String userPhone,
                         @RequestBody Map<String,String> comands,
                         @RequestParam("msg") String msg) throws Exception;

    /**
     * <desc>
     *      任务指令推送。
     * <desc/>
     *
     * @param   userPhone  用户手机
     * @param  comands 指令
     * @param  msg 推送信息
     * @return
     * @author shengen.T
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/iotTp/push/pushWithTask",method = RequestMethod.POST)
    boolean pushWithTask(@RequestParam("userPhone") String userPhone,
                         @RequestBody Map<String,String> comands,
                         @RequestParam("msg") String msg) throws Exception;

     /**
      * <desc>
      *      别名指令推送。
      * <desc/>
      *
      * @param  msg 推送信息
      * @param  alias 别名列表
      * @return
      * @author shengen.T
      * @createDate 2017/10/12
      */
    @RequestMapping(path = "/iotTp/push/pushWithAliases",method = RequestMethod.POST)
    boolean pushWithAliases ( @RequestParam("alias") List<String> alias,@RequestParam("msg") String msg) throws Exception;



    /**
     * <desc>
     *      任务指令推送。
     *      重复登录提示
     * <desc/>
     *
     * @param   phoneNO  用户手机
     * @param  uuid 唯一编号
     * @param  msg 推送信息
     * @return
     * @author shengen.T
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/iotTp/push/pushWithTaskLogin",method = RequestMethod.POST)
    boolean pushWithTaskLogin(@RequestParam("phoneNO") String phoneNO,
                         @RequestParam("uuid") String uuid,
                         @RequestParam("msg") String msg) throws Exception;

     /**
      * <desc>
      *      人脸认证消息推送。
      * <desc/>
      *
      * @param   userPhone  用户手机
      * @param  comands 指令
      * @param  msg 推送信息
      * @return
      * @author shengen.T
      * @createDate 2018-05-08
      */
     @RequestMapping(path = "/iotTp/push/pushWithFaceVerificationTask",method = RequestMethod.POST)
    boolean pushWithFaceVerificationTask(@RequestParam("userPhone") String userPhone,
                                         @RequestParam("msg") String msg,
                                         @RequestBody Map<String,String> comands) throws Exception;
}
